package system.student.mapper;

import org.apache.ibatis.annotations.Param;
import org.apache.ibatis.annotations.Select;
import org.apache.ibatis.annotations.Update;
import system.student.entity.user.UserInfo;

public interface UserMapper {
    void register(UserInfo userInfo);

    @Select("SELECT * FROM user WHERE username = #{username}")
    UserInfo loginByPassword(String username);


    @Select("SELECT * FROM user WHERE phone = #{phone}")
    UserInfo loginByPhone(String phone);

    @Select("SELECT * FROM user WHERE email = #{email}")
    UserInfo loginByEmail(String email);

    @Select("select * from user where id = #{userId}")
    UserInfo selectByUserId(Long userId);

    @Update("update user set password = #{password} where id = #{userId}")
    void updatePasswordByUserId(@Param("userId") Long userId, @Param("password") String password);
}
